package com.digua.base.socket

import com.digua.base.socket.request.Request
import com.digua.base.socket.response.Response

interface SocketWrapperListener {
    /**
     * 链接成功
     */
    fun onConnected()

    /**
     * 链接失败
     */
    fun onConnectFailed(e: Throwable?)

    /**
     * 链接断开
     */
    fun onDisconnect()

    /**
     * 数据发送失败
     *
     * @param request 发送的请求
     * @param type    失败类型：[com.zhangke.websocket.response.ErrorResponse.ERROR_NO_CONNECT] 未链接、
     * [com.zhangke.websocket.response.ErrorResponse.ERROR_UNKNOWN] 未知错误、
     * [com.zhangke.websocket.response.ErrorResponse.ERROR_UN_INIT] 初始化未完成
     */
    fun onSendDataError(request: Request<*>?, type: Int, tr: Throwable?)

    /**
     * 接收到消息
     */
    fun onMessage(message: Response<*>?)
}